// 1 使用2种方法进行排序
let arr = [0, 10, -1, 9, 2, 5]
let sort1 = (list) => {
  let n = list.length
  for (let i = 0; i < n - i; i++) {
    for (let j = 0; j < n - i - 1; j++) {
      if (list[j] > list[j + 1]) {
        let t = list[j]
        list[j] = list[j + 1]
        list[j + 1] = t
      }
    }
  }
}
let sort2 = (list) => list.sort((a, b) => a - b)
sort2(arr)
// console.log(arr) // [ -1, 0, 2, 5, 9, 10 ]

// 2 str重复n次
let repeatString = (str, n) => {
  if (isString(str) && !isEmptyString(str)) {
    return str.repeat(n)
  }
  return ''
}
let rt = repeatString('abc', 3)
console.log(rt)

// 3 输入两个值，比较大小
let inputNum = () => {
  let n = prompt('输入一个数:')
  n = Number(n)
  if (Number.isNaN(n)) {
    throw '输入的内容必须是数字'
  }
  return n
}
let getMax = () => {
  let n = inputNum()
  let m = inputNum()
  return m > n ? m : n
}
console.log('max=' + getMax())
